import axiosFn  from '@/utils/request';

import { IFilter } from '@/typings/IFilter';
import { GxTask } from '@/typings/GxTask';
const taskService={
    save:(task:GxTask) => {
        return new Promise((resolve,reject)=>{
            axiosFn.commonOnPost("/task/save",task)
            .then(res=>{
                resolve(res);
            })
        })
    },
    query:(filter:IFilter) => {
        return new Promise((resolve,reject)=>{
            axiosFn.commonOnPost("/task/query",filter)
            .then(res=>{
                resolve(res);
            })
        })
    },
    update:(task:GxTask) => {
        return new Promise((resolve,reject)=>{
            axiosFn.commonOnPost("/task/update",task)
            .then(res=>{
                resolve(res);
            })
        })
    },
    delete:(id:number) => {
        return new Promise((resolve,reject)=>{
            axiosFn.commonOnDeleteById("/task/delete",id)
            .then(res=>{
                resolve(res);
            })
        })
    },
    complete:(id:number) => {
        return new Promise((resolve,reject)=>{
            axiosFn.commonOnGet(`/task/complete/${id}`,{})
            .then(res=>{
                resolve(res);
            })
        })
    }
};
export default taskService;